home *** CD-ROM | disk | FTP | other *** search
- *
- * ZKick V3.01 -- Copyright (C) 1991 by Daniel Zenchelsky
- *
- * This program may be freely copied, as long as all copyright
- * notices are left intact and unchanged.
- *
-
-
- XDEF KickPatch
-
- XREF _LOADC0
- XREF _V175
- XREF _PRINT
-
- XREF Reboot
- XREF _StartKick
- XREF rtable
- XREF CheckSum
-
- INCLUDE 'zkick.i'
-
- KickMemPtr EQU $222
- KickTagPtr EQU $226
- KickCheckSum EQU $22a
- WarmCapture EQU 50
- CoolCapture EQU 46
- ColdCapture EQU 42
-
- ROMSIZE EQU $080000
-
- ROMCHECK EQU ROMSIZE-$18
- ROMLONG EQU ROMSIZE/4
-
- KickPatch:
-
- PUTMSG <'kickpatch'>
-
- move.l _StartKick,a0 ; Checksum KickStart image
- move.l #$80000,d1 ; at _StartKick
- jsr CheckSum
- tst.l d0
- beq.s reloc
- ; Uh oh, doesn't look like
- ; KickStart at _StartKick
- PUTMSG <'panic in kickpatch!'>
-
- clr.l ColdCapture(a6)
- clr.l CoolCapture(a6)
- clr.l WarmCapture(a6) ; Clear vectors and reboot
- clr.l KickTagPtr(a6)
- clr.l KickMemPtr(a6)
-
- jmp Reboot
-
- reloc:
- tst.l _V175
- beq.s .done
-
- move.l _StartKick,D0
- sub.l #$200000,D0
- lea.l rtable,A0
-
- .loop:
- tst.l (A0)
- beq.s .done
-
- move.l _StartKick,A1
- add.l (A0)+,A1
- add.l D0,(A1)
- bra.s .loop
-
- .done:
- tst.l _LOADC0
- beq.s sum
-
- PUTMSG <'Patching for $C00000 load'>
-
- move.l _StartKick,A0
- move.l #$287C0000,$2B2(A0)
- move.l #$00004E71,$2B6(A0)
- move.l #$4E714E71,$2BA(A0)
- move.l #$4E714E71,$2BE(A0)
-
- sum:
-
- SumKick:
- PUTMSG <'SumKick'>
-
- MOVE.L _StartKick,A0
- MOVE.L A0,A1
- ADD.L #ROMCHECK,A1
- CLR.L (A1)
- MOVE.L #ROMLONG-1,D1
- MOVEQ #0,D0
-
- 1$: ADD.L (A0)+,D0
- BCC.S 2$
- ADDQ.L #1,D0
- 2$: DBRA D1,1$
-
- SUB.L #$10000,D1
- BPL.S 1$
- NOT.L D0
- MOVE.L D0,(A1)
- RTS
-
- END
-